# -*- coding: utf-8 -*-
# @time     : 2022/10/26 0026 9:59
# @Author   : mingy
# @File     : whois_check_socket.py
# @Software : PyCharm

import socket

domain = input(" >>> 输入查询 Whois 的域名：>>> ")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('Whois.internic.net', 43))
s.send(f'{domain} \r\n'.encode())

while True:
    v = s.recv(1024)
    if not v:
        break
    v1 = v.decode()
    print(v1)
s.close()
